﻿using B.S.Unit.Domain;
using B.S.Unit.ErrorCode;
using B.S.Unit.Read.API.Applications.Command;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace B.S.Unit.Read.API.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class UnitManageController : ControllerBase
    {
        private readonly IMediator mediator;

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="mediator"></param>
        public UnitManageController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        [HttpGet]
        public Task<UnitPaging<UnitApp>> GetUnit([FromQuery]GetUnitCommand command)
        {
            return mediator.Send(command);
        }
    }
}
